/*
 * Copyright 2010 J Patrick Davenport
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package v4view.web;

public class Head extends ChildbearingPageElement implements ILanguageAttributes<Head> {

	private static final String	TITLE_KEY	= "title";
	private static final String	HEAD		= "head";

	{
		this.setSupportsAttributes(true);
		this.setTag(HEAD);
	}

	public Head setTitle(final String _title) {
		final Dynamic element = new Dynamic(TITLE_KEY, _title);
		element.setElementId(TITLE_KEY);
		this.addPageElement(element);
		return this;
	}

	public String getTitle() {
		return ((Dynamic) this.findElement(TITLE_KEY)).getBodyContent();
	}

	@Override
	public Head setDir(final String _value) {
		return (Head) this.setAttribute(DIR_KEY, _value);
	}

	@Override
	public Head setLang(final String _lang) {
		return (Head) this.setAttribute(LANG_KEY, _lang);
	}

	@Override
	public Head setXmlLang(final String _xmlLang) {
		return (Head) this.setAttribute(XML_LANG_KEY, _xmlLang);
	}

	@Override
	public String getDir() {
		return this.getAttributeValue(DIR_KEY);
	}

	@Override
	public String getLang() {
		return this.getAttributeValue(LANG_KEY);
	}

	@Override
	public String getXmlLang() {
		return this.getAttributeValue(XML_LANG_KEY);
	}
}
